/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function dv(){
    var rut = $jQuery(".validate_rut").val();
    var parte = rut.split("-");

    var T = parte[0];
    var dv = parte[1];

    var M=0,S=1;
    for(;T;T=Math.floor(T/10))
        S=(S+T%10*(9-M++%6))%11;
    var dv2 = S?S-1:'k';
    if(dv != dv2){
        alert("Rut no valido");
        $jQuery(".validate_rut").val("");
    }
}